From 9658a68387e123e980d8d9e3149db2382c0dd42d Mon Sep 17 00:00:00 2001 From: robertl Date: Wed, 27 Aug 2003 18:05:41 +0000 Subject: [PATCH] Make GPX not crash when we have -s and *only* a shortname already. --- gpsbabel/Makefile | 4 ++-- gpsbabel/gpx.c | 18 ++++++++++++++++-- 2 files changed, 18 insertions(+), 4 deletions(-) diff --git a/gpsbabel/Makefile b/gpsbabel/Makefile index 15f435227..f77200616 100644 --- a/gpsbabel/Makefile +++ b/gpsbabel/Makefile @@ -69,8 +69,8 @@ dep: (echo -n "internal_styles.c: mkstyle.sh " ; echo style/*.style ; /bin/echo -e "\t./mkstyle.sh > $@ || (rm -f $@ ; exit 1)" ) >> /tmp/dep echo Edit Makefile and bring in /tmp/dep -VERSIONU=1_1_1_beta08122003 -VERSIOND=1.1.1_beta08122003 +VERSIONU=1_1_1_beta08262003 +VERSIOND=1.1.1_beta08262003 release: rm -fr gpsbabel-$(VERSIOND) cvs tag gpsbabel_$(VERSIONU) diff --git a/gpsbabel/gpx.c b/gpsbabel/gpx.c index 5ed82708e..f9d82ba27 100644 --- a/gpsbabel/gpx.c +++ b/gpsbabel/gpx.c @@ -941,8 +941,22 @@ static void gpx_waypt_pr(const waypoint *waypointp) { char *tmp_ent; - const char *oname = global_opts.synthesize_shortnames ? - mkshort(mkshort_handle, waypointp->notes) : + const char *oname; + char *odesc; + + /* + * Desparation time, try very hard to get a good shortname + */ + odesc = waypointp->notes; + if (!odesc) { + odesc = waypointp->description; + } + if (!odesc) { + odesc = waypointp->shortname; + } + + oname = global_opts.synthesize_shortnames ? + mkshort(mkshort_handle, odesc) : waypointp->shortname; fprintf(ofd, "\n", -- 2.30.2